﻿#nullable enable

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Mvc;
using PHMEE.Controllers;

namespace PHMEE.EnergyEfficiency;

/// <summary>
/// 航次
/// </summary>
[Route("api/cbm/voyage")]
public class VoyageController : PHMEEController, IVoyageAppService
{
    private readonly IVoyageAppService _voyageAppService;

    public VoyageController(IVoyageAppService voyageAppService)
    {
        _voyageAppService = voyageAppService;
    }
    
    /// <summary>
    /// 获取日期段内的完整航次；
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="startDate"></param>
    /// <param name="endDate"></param>
    /// <returns></returns>
    [Route("GetVoyages")]
    [HttpGet]
    public Task<List<VoyageDto>> GetVoyagesAsync(Guid vesselId, [Required] DateTime startDate, [Required] DateTime endDate)
    {
        return _voyageAppService.GetVoyagesAsync(vesselId, startDate, endDate);
    }

    /// <summary>
    /// 获取日期段内的完整航次及对应能效信息；
    /// </summary>
    /// <param name="vesselId"></param>
    /// <param name="startDate"></param>
    /// <param name="endDate"></param>
    /// <returns></returns>
    [Route("GetVoyagesEEInfo")]
    [HttpGet]
    public Task<List<VoyageEEInfoDto>> GetVoyagesEEInfoAsync(Guid vesselId, DateTime startDate, DateTime endDate)
    {
        return _voyageAppService.GetVoyagesEEInfoAsync(vesselId, startDate, endDate);
    }
}